{% load static %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>垃圾分类查询系统</title>
    <link rel="stylesheet" href="{% static 'css/style.css' %}">
    <style>
        :root {
            --primary: #4CAF50;
            --primary-dark: #388E3C;
            --secondary: #2196F3;
            --accent: #FFC107;
            --text: #333333;
            --text-light: #757575;
            --background: #FFFFFF;
            --background-alt: #F5F5F5;
            --border: #E0E0E0;
            --success: #66BB6A;
            --error: #F44336;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background-color: var(--background);
            color: var(--text);
            line-height: 1.6;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }

        header {
            background-color: var(--primary);
            color: white;
            padding: 1rem 0;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }

        .header-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        header h1 {
            font-size: 1.8rem;
            font-weight: 600;
        }

        .user-actions {
            display: flex;
            align-items: center;
        }

        .user-actions a {
            color: white;
            text-decoration: none;
            margin-left: 15px;
            padding: 5px 10px;
            border-radius: 4px;
            transition: background-color 0.3s;
        }

        .user-actions a:hover {
            background-color: var(--primary-dark);
        }

        nav {
            background-color: var(--primary-dark);
            padding: 0.7rem 0;
        }

        .nav-links {
            display: flex;
            justify-content: flex-start;
            flex-wrap: wrap;
        }

        nav a {
            color: white;
            text-decoration: none;
            padding: 5px 15px;
            margin-right: 5px;
            border-radius: 4px;
            transition: background-color 0.3s;
        }

        nav a:hover {
            background-color: rgba(255,255,255,0.2);
        }

        main {
            min-height: calc(100vh - 180px);
            padding: 2rem 0;
        }

        footer {
            background-color: var(--text);
            color: white;
            text-align: center;
            padding: 1.5rem 0;
            margin-top: 2rem;
        }

        /* 通用样式 */
        h2 {
            color: var(--primary-dark);
            margin-bottom: 1.5rem;
            padding-bottom: 0.5rem;
            border-bottom: 2px solid var(--primary);
            display: inline-block;
        }

        h3 {
            color: var(--primary);
            margin: 1rem 0;
        }

        a {
            color: var(--secondary);
            text-decoration: none;
        }

        a:hover {
            text-decoration: underline;
        }

        button, input[type="submit"] {
            background-color: var(--primary);
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        button:hover, input[type="submit"]:hover {
            background-color: var(--primary-dark);
        }

        input[type="text"], input[type="password"], input[type="email"] {
            padding: 8px 12px;
            border: 1px solid var(--border);
            border-radius: 4px;
            width: 100%;
            max-width: 400px;
        }

        ul {
            list-style-position: inside;
            margin: 1rem 0;
        }

        li {
            margin-bottom: 0.5rem;
            padding: 0.5rem;
            border-radius: 4px;
        }

        li:nth-child(odd) {
            background-color: var(--background-alt);
        }

        .card {
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            transition: transform 0.3s, box-shadow 0.3s;
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.15);
        }

        .btn {
            display: inline-block;
            background-color: var(--primary);
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            text-decoration: none;
            transition: background-color 0.3s;
        }

        .btn:hover {
            background-color: var(--primary-dark);
            text-decoration: none;
        }

        .btn-secondary {
            background-color: var(--secondary);
        }

        .btn-secondary:hover {
            background-color: #1976D2;
        }

        .meta-info {
            color: var(--text-light);
            font-size: 0.9rem;
            margin-bottom: 1rem;
        }

        @media (max-width: 768px) {
            .header-content {
                flex-direction: column;
                text-align: center;
            }

            .user-actions {
                margin-top: 1rem;
            }

            .nav-links {
                justify-content: center;
            }

            nav a {
                margin: 5px;
            }
        }
    </style>
</head>
<body>
    <header>
        <div class="container">
            <div class="header-content">
                <h1>垃圾分类平台</h1>
                <div class="user-actions">
                    {% if user.is_authenticated %}
                        <span>欢迎，{{ user.username }}！</span>
                        <a href="{% url 'logout' %}">退出</a>
                    {% else %}
                        <a href="{% url 'login' %}">登录</a>
                        <a href="{% url 'register' %}">注册</a>
                    {% endif %}
                </div>
            </div>
        </div>
    </header>

    <nav>
        <div class="container">
            <div class="nav-links">
                <a href="{% url 'home' %}">首页</a>
                <a href="{% url 'search' %}?q=">垃圾查询</a>
                {% if user.is_authenticated %}
                    <a href="{% url 'my_history' %}">我的查询记录</a>
                    <a href="{% url 'my_favorites' %}">我的收藏</a>
                {% endif %}
                <a href="{% url 'article_list' %}">宣传文章</a>
            </div>
        </div>
    </nav>

    <main>
        <div class="container">
            {% block content %}{% endblock %}
        </div>
    </main>

    <footer>
        <div class="container">
            <p>&copy; 2025 垃圾分类平台 | 保护环境，从分类开始</p>
        </div>
    </footer>
</body>
</html>